<?php
/**
 * Created by PhpStorm.
 * User: 12133
 * Date: 2024/8/29
 * Time: 14:53
 */

namespace app\model;


use app\model\index\Web;
use think\Model;

class Customer extends Model
{
    protected $autoWriteTimestamp = 'datetime';
    protected $append = ['status_text'];
    public function getStatusTextAttr($value,$data){
        $array =[
            1 => '正常',
            2 => '禁用'
        ];
        return $array[$data['status']];
    }

    public function web(){
        return $this->hasMany(Web::class,'customer_id','id');
    }

    public function keywords(){
        return $this->hasMany(CustomerKeywords::class,'customer_id','id');
    }
}